import 'dart:convert';

FlowerListModel flowerListModelFromJson(String str) => FlowerListModel.fromJson(json.decode(str));

String flowerListModelToJson(FlowerListModel data) => json.encode(data.toJson());

class FlowerListModel {
  int code;
  String ? message;
  List<FlowerData> ? data;

  FlowerListModel({
    required this.code,
    this.message,
    this.data,
  });

  factory FlowerListModel.fromJson(Map<String, dynamic> json) => FlowerListModel(
    code: json["code"],
    message: json["message"],
    data: List<FlowerData>.from(json["data"].map((x) => FlowerData.fromJson(x))),
  );

  Map<String, dynamic> toJson() => {
    "code": code,
    "message": message,
    "data": List<dynamic>.from(data!.map((x) => x.toJson())),
  };
}

class FlowerData {
  int id;
  int tid;
  String name;
  String ename;
  String meaning;
  String description;
  double price;
  int inventory;
  int sales;
  int views;
  String unit;
  String coverUrl;
  String img1;
  String img2;
  String img3;
  int status;
  String tname;


  FlowerData({
    required this.id,
    required this.tid,
    required this.name,
    required this.ename,
    required this.meaning,
    required this.description,
    required this.price,
    required this.inventory,
    required this.sales,
    required this.views,
    required this.unit,
    required this.coverUrl,
    required this.img1,
    required this.img2,
    required this.img3,
    required this.status,
    required this.tname,
  });

  factory FlowerData.fromJson(Map<String, dynamic> json) => FlowerData(
    id: json["id"],
    tid: json["tid"],
    name: json["name"],
    ename: json["ename"],
    meaning: json["meaning"],
    description: json["description"],
    price: json["price"],
    inventory: json["inventory"],
    sales: json["sales"],
    views: json["views"],
    unit: json["unit"],
    coverUrl: json["coverUrl"],
    img1: json["img1"],
    img2: json["img2"],
    img3: json["img3"],
    status: json["status"],
    tname: json["tname"],
  );

  Map<String, dynamic> toJson() => {
    "id": id,
    "tid,": tid,
    "name": name,
    "ename": ename,
    "meaning": meaning,
    "description": description,
    "price": price,
    "inventory": inventory,
    "sales": sales,
    "views": views,
    "unit": unit,
    "coverUrl": coverUrl,
    "img1": img1,
    "img2": img2,
    "img3": img3,
    "status": status,
    "tname": tname,
  };
}
